<template>
	<view class="materialsCome">
		<!-- 材料出库 主页面 -->
		<navBar title="材料出库" goBackUrl="/pages/homePage/platform" @goBack="goBack"></navBar>
		
		<scroll-view scroll-y="true" class="scroll-box">
			<view class="content">
				<view class="center">
					<view class="nav">
						<image class="img1" src="/subpackage-materials/static/tijiao2.png" mode="" @click="getClick(0)"></image>
						
						<image class="img1" src="/subpackage-materials/static/look2.png" mode="" @click="getClick(1)"></image>
					</view>
					
					<!-- 设备出库 提交 -->
					<comeSubmit v-if="isShow" :projectCascade="projectCascade" @confirm="confirm"></comeSubmit>
					
					<!-- 设备出库 查看 -->
					<comeLook v-else></comeLook>
				</view>
			</view>
		</scroll-view>
		
	</view>
</template>

<script>
	import comeSubmit from "./components/comeSubmit.vue"
	import comeLook from "./components/comeLook.vue"
	import { mapState } from "vuex"
	export default {
		name:"materialsCome",
		components: {
			comeSubmit, comeLook
		},
		data() {
			return {
				isShow: true,
				projectCascade: "",
			}
		},
		computed: {
			...mapState('materials',['projectName'])
		},
		onShow() {
			if(this.projectName){
				this.projectCascade = this.projectName.split(",")
			}else{
				this.projectCascade = []
			}
			console.log(this.projectName,this.projectCascade)
		},
		methods: {
			getClick(num){
				if(num === 0){
					this.isShow = true
				}else{
					this.isShow = false
				}
			},
			
			// 返回上一级
			goBack(url){
				uni.switchTab({
					url: url
				})
			},
			confirm(bool){
				if(bool){
					this.projectCascade = []
				}
				// console.log('000000000',val)
			}
		}
	}
</script>

<style lang="scss" scoped>
	.materialsCome{
		/* #ifdef MP-WEIXIN */
			padding-top: 180rpx;
		/* #endif */
		.scroll-box{
			max-height: calc(100vh - 170rpx);
			padding-top: 10rpx;
		}
		.content{
			background-color: #F5F7FA;
			padding-top: 30rpx;
			.center{
				background-color: #FFFFFF;
				padding:0rpx 28rpx;
				.nav{
					padding-top:20rpx;
					display: flex;
					justify-content: space-between;
					height: 113rpx;
					margin-bottom: 10rpx;
				}
				.img1{
					width: 328rpx;
					height: 96rpx;
				}
			}
		}
	}
</style>
